package com.seeyon.ctp.rest.resources;

import com.alibaba.fastjson.JSONObject;
import com.seeyon.apps.brwh.service.FormTableWordService;
import com.seeyon.ctp.common.AppContext;

import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.Map;

/**
 * 表单转word接口
 */
@Path("jssdk")
@Produces({MediaType.APPLICATION_JSON})
public class FormTableWordResources extends BaseResource {
    private FormTableWordService formTableWordService = (FormTableWordService) AppContext.getBean("formTableWordService");



    /**
     * 表单转word
     *
     * @param param 请求参数，格式为Map<String, Object>
     * @return Response 返回响应对象
     * @throws Exception 异常处理
     */
    @POST
    @Path("formTable/word")
    @Consumes(MediaType.APPLICATION_JSON)
    public Response formTableWord(Map<String, Object> param) throws Exception {
        Map<String, Object> dataMap = formTableWordService.formTableWord(param);
        return this.ok(JSONObject.toJSONString(dataMap));
    }
}
